﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Exector{
	public Dictionary<System.Enum,System.Action> commands = new Dictionary<System.Enum,System.Action>();
	public void Bind(System.Enum _enum,System.Action action){
		if (!commands.ContainsKey (_enum)) {
			commands.Add(_enum,action);
		}
		commands[_enum] =  action;
	}
	public void UnBind(System.Enum _enum){
		if (commands.ContainsKey (_enum))
			commands.Remove (_enum);
	}
	public void Execute(System.Enum _enum){
		if (commands.ContainsKey (_enum))
			commands [_enum] ();
	}
}
public class ExectorMono:MonoBehaviour{
	Exector exector = new Exector();
	public void Bind(System.Enum _enum,System.Action action){
		exector.Bind (_enum, action);
	}
	public void Execute(System.Enum _enum){
		exector.Execute (_enum);
	}
} 